<?php
if (!defined("__WD__")) exit("Wrong Connect");

class Generate extends __Controller {

	private $key = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#%^&*()-_=+~";

	private $path_config = null;

	function __construct() {
	
		parent::__construct();
		$this->data->title = "Generate!";
	}

	
	// Login Chkeck 구현
	function index() {
		$href = "http://".HOME."/generate";
		$this->data->body = <<<EOD
<a href="{$href}/key">Key Generate</a>	
EOD;
		$this->load->view("admin/layout");
	}
	function key() {
		$key64 = $this->_genkey(64/8);
		$key448 = $this->_genkey(448/8);
		$key512 = $this->_genkey(512/8);

		$this->data->body = <<<EOD
	\$config["key64"]    = "{$key64}";
	\$config["key448"]   = "{$key448}";
	\$config["key512"]   = "{$key512}";
EOD;
		$this->data->body = nl2br($this->data->body);
		$this->load->view("admin/layout");
		
	}
	function _genkey( $n ) {
		$key = "";
		$KL = strlen($this->key)-1;
		
		for ($i = 0; $i < $n; $i++) $key .= $this->key[rand(0, $KL)];
		return $key;
	}


	

}